Matthias Clasen [Tue, 2 Jul 2019 11:41:32 +0000 (11:41 +0000)]
constraint editor: Implement loading
Allow to reread the ui builder files we write out.
Just barely.
Matthias Clasen [Tue, 2 Jul 2019 04:35:16 +0000 (04:35 +0000)]
constraints editor: Stop naming constraints
We don't have a field for the name in ui files,
so stop naming constraints.
Matthias Clasen [Mon, 1 Jul 2019 18:39:36 +0000 (18:39 +0000)]
constraint editor: Implement saving
Save to a ui file.
Matthias Clasen [Tue, 2 Jul 2019 03:15:12 +0000 (03:15 +0000)]
constraint editor: Use name properties
Matthias Clasen [Tue, 2 Jul 2019 00:15:55 +0000 (20:15 -0400)]
constraint editor: Use the list models
Instead of handrolling our own list models,
use the ones provided by GtkConstraintLayout.
Matthias Clasen [Tue, 2 Jul 2019 00:14:26 +0000 (20:14 -0400)]
constraint layout: Provide list models
Provide list models for the constraints and guides,
so we can show them in the inspector, and use them
in e.g. the constraints editor.
Matthias Clasen [Tue, 2 Jul 2019 14:01:01 +0000 (14:01 +0000)]
Merge branch 'wip/ebassi/constraint-layout' into 'master'
Add constraint-based layout manager
Closes #1090
See merge request GNOME/gtk!973
Emmanuele Bassi [Tue, 2 Jul 2019 08:48:17 +0000 (09:48 +0100)]
docs: Add more private headers to the list
The various GtkConstraint private API should not be scanned for
documentation.
Emmanuele Bassi [Tue, 2 Jul 2019 08:44:48 +0000 (09:44 +0100)]
docs: Fix typo in function name
Daniel Boles [Mon, 1 Jul 2019 18:13:45 +0000 (19:13 +0100)]
widget-factory: Use correct StyleProvider priority
We are an application, not a user.
cherry-pick of !974
Matthias Clasen [Tue, 2 Jul 2019 01:28:43 +0000 (01:28 +0000)]
Merge branch 'option-names' into 'master'
meson: Rename documentation option to gtk_doc
See merge request GNOME/gtk!972
Benjamin Otte [Mon, 1 Jul 2019 23:57:20 +0000 (23:57 +0000)]
flattenlistmodeL: Compute items-changed position properly
The code previously forgot to include the left child of the model's
node. Which of course only happened if that child wasn't NULL, which is
a common case.
Found and test provided by Matthias Clasen.
Matthias Clasen [Mon, 1 Jul 2019 16:57:16 +0000 (12:57 -0400)]
meson: Rename documentation option to gtk_doc
This name is what most of the stack is using.
Lets follow along, even though it is (imo)
uglier.
Christoph Reiter [Mon, 1 Jul 2019 19:52:06 +0000 (21:52 +0200)]
meson: cups: use cups-config for looking up cups
We were looking for the cups headers and the cups lib in the default locations
which for example breaks with OpenBSD where the cups headers are under /usr/local/include/
Instead just use the "cups" dependency type from meson which internally uses cups-config.
See #1967
Ported to master from !963
Christoph Reiter [Sat, 15 Jun 2019 07:42:17 +0000 (09:42 +0200)]
build/cups: remove checks for httpGetAuthString and http_t.authstring
httpGetAuthString() was added with cups 1.3 and we depend on a newer version
now. The direct field access was a fallback in case httpGetAuthString()
was missing, so this can also be dropped.
Ported to master from !938
Emmanuele Bassi [Mon, 1 Jul 2019 18:22:48 +0000 (19:22 +0100)]
Add custom parser for guides defined in GtkBuilder UI files
Like we describe constraints, we can also define guides.
Emmanuele Bassi [Mon, 1 Jul 2019 17:03:20 +0000 (18:03 +0100)]
Implement GtkBuildable for GtkConstraintLayout
Using GtkBuildable we can provide a custom parser for reading
constraints defined in a GtkBuilder UI file.
Emmanuele Bassi [Mon, 1 Jul 2019 17:02:19 +0000 (18:02 +0100)]
Use the right GValue getter for GtkConstraintGuide:strength
The property is defined as an enum.
This fixes the defaultvalue and notify tests.
Emmanuele Bassi [Mon, 1 Jul 2019 11:39:24 +0000 (12:39 +0100)]
Use explicit values for constraint strength
Instead of playing games with mapping negative symbolic values to
positive ones, let's use the appropriate constants everywhere. This
allows us to use:
GTK_CONSTRAINT_STRENGTH_WEAK * 2
Or
GTK_CONSTRAINT_STRENGTH_STRONG + 1
In code using the public API.
We also store the strength values as integers, so we can compare them
properly, and only turn them into doubles when they are inserted into
the solver, just like every other variable.
Matthias Clasen [Mon, 1 Jul 2019 04:24:26 +0000 (04:24 +0000)]
constraint editor: Allow dragging children
We add a weak constraint for the position
and update it as the widget is dragged.
Matthias Clasen [Mon, 1 Jul 2019 03:17:58 +0000 (03:17 +0000)]
Documentation fixes
Make sure all types show up in the docs,
and misc other improvements.
Matthias Clasen [Mon, 1 Jul 2019 02:23:39 +0000 (02:23 +0000)]
constraint editor: Enable max size for guide
Also, use the apis we have now, and make the
spin buttons display 'unset' values as such.
Matthias Clasen [Sat, 29 Jun 2019 04:17:46 +0000 (04:17 +0000)]
constraint layout: go back to keeping constraints
We want to minimize changes to the solver, so
keep the size constraints around and only update
them when the size changes.
Matthias Clasen [Sat, 29 Jun 2019 22:20:20 +0000 (22:20 +0000)]
constraint layout: Use stronger force for min size
We want our edit constraint to be strong enough to
overpower nat. size constraint, therefore use STRONG * 2.
Emmanuele Bassi [Mon, 1 Jul 2019 00:13:00 +0000 (01:13 +0100)]
Fix warnings from the introspection scanner
The name of the arguments of the functions must match the name of the
arguments in the documentation stanza.
Emmanuele Bassi [Mon, 1 Jul 2019 00:12:25 +0000 (01:12 +0100)]
Add gtkconstraintguide.h to the public headers
It needs to be introspected and installed.
Emmanuele Bassi [Mon, 1 Jul 2019 00:05:04 +0000 (01:05 +0100)]
Remove specialised API from GtkConstraint
Thet widget-based API for constraint target and source properties is
unused, and not really necessary.
Emmanuele Bassi [Mon, 1 Jul 2019 00:02:56 +0000 (01:02 +0100)]
Add missing documentation for GtkConstraint
Emmanuele Bassi [Sun, 30 Jun 2019 23:49:20 +0000 (00:49 +0100)]
docs: Add GtkConstraint and friends to the API reference
Emmanuele Bassi [Sun, 30 Jun 2019 23:48:59 +0000 (00:48 +0100)]
Document GtkConstraintGuide
Emmanuele Bassi [Sun, 30 Jun 2019 23:47:44 +0000 (00:47 +0100)]
Move the VFL error domain to a public header
Since the public API will use it to fill out GErrors, it needs to be
publicly available.
Matthias Clasen [Sun, 30 Jun 2019 23:17:40 +0000 (23:17 +0000)]
Merge branch 'gbsneto/fix-popover-dark-theme' into 'master'
Fix GtkPopoverMenu in dark theme
See merge request GNOME/gtk!970
Matthias Clasen [Sun, 30 Jun 2019 13:25:30 +0000 (13:25 +0000)]
Add a constraint editor demo
This is an initial cut at providing a tool
for interactive exploration of constraints.
Emmanuele Bassi [Sun, 30 Jun 2019 22:59:04 +0000 (23:59 +0100)]
constraint layout: Notice when guides change
We need to queue a resize here.
Matthias Clasen [Sat, 29 Jun 2019 22:51:28 +0000 (22:51 +0000)]
Mark the layout as changed
We should mark the layout as changed when
constraints are added or removed.
Matthias Clasen [Sat, 29 Jun 2019 22:14:29 +0000 (22:14 +0000)]
constraint guide: Avoid redundant constraints
There is no point in creating a stay for nat
size when min == max. And no point in a constraint
for <= G_MAXINT either.
Matthias Clasen [Sat, 29 Jun 2019 22:13:41 +0000 (22:13 +0000)]
constraint guide: Fix initial property values
This was overlooked when the max-width/max-height/
strength properties were added.
Matthias Clasen [Sat, 29 Jun 2019 20:40:34 +0000 (20:40 +0000)]
constraint solver: Use GTK_NOTE
Allow using GTK_DEBUG=constraints to get debug
output from the constraints solver.
Matthias Clasen [Sat, 29 Jun 2019 17:38:36 +0000 (17:38 +0000)]
solver: Add private statistics api
No point in keeping these counters without
a way to show them.
Matthias Clasen [Sat, 29 Jun 2019 17:36:47 +0000 (17:36 +0000)]
constraint layout: Dont reset constraints in allocate
If trust our allocation algorithm, this can never
trigger (and in fact, it never does).
Matthias Clasen [Sat, 29 Jun 2019 14:21:58 +0000 (14:21 +0000)]
constraints: Add some internal apis
Checking if a set is empty or a singleton can
be done more efficiently than determining its size.
Matthias Clasen [Sat, 29 Jun 2019 14:18:23 +0000 (14:18 +0000)]
constraint guide: Make strength tweakable
The strength for the natural width can be used
as a tie-breaker to make instable systems behave
in a more predictable way. This can be seen
in the simple constraints demo in gtk-demo.
Matthias Clasen [Sat, 29 Jun 2019 14:15:42 +0000 (10:15 -0400)]
constraints demo: Update comments
Matthias Clasen [Sat, 29 Jun 2019 05:06:56 +0000 (05:06 +0000)]
constraint layout: freeze/thaw on mass ops
In measure and allocate we are potentially
changing quite a few constraints. Don't
optimize at every step.
Matthias Clasen [Sat, 29 Jun 2019 04:59:49 +0000 (04:59 +0000)]
constraints: Use better data structures
Use a GSequence for GtkVariableSet, to avoid
quadratic behavior.
Matthias Clasen [Fri, 28 Jun 2019 23:00:34 +0000 (23:00 +0000)]
constraint layout: Measure min/nat size separately
Only constraint the opposite direction if we
actually have a for_size, and measure natural
size after removing the edit constraints. With
these changes, the test that compares constraint
layout to grid layout passes.
Matthias Clasen [Fri, 28 Jun 2019 22:59:38 +0000 (22:59 +0000)]
constraint layout: Use stays for natural size
It makes more sense to treat the natural size
of both children and guides as stays, since
we want to meet these values as closely as we
can, under the circumstances.
Matthias Clasen [Fri, 28 Jun 2019 22:55:39 +0000 (22:55 +0000)]
constraint layout: Add debug output for guides
Print out the allocation we end up giving to
guides. This helps in making sense of the
allocations of the child widgets that these
guides relate to.
Matthias Clasen [Fri, 28 Jun 2019 22:54:28 +0000 (22:54 +0000)]
constraints demo: Give space a name
Lets call it 'space'.
Matthias Clasen [Fri, 28 Jun 2019 22:53:43 +0000 (22:53 +0000)]
constraint guide: Add a name property
We need to be able to print meaningful debug messages
regarding these objects, and eventually present them
in the inspector too.
Matthias Clasen [Fri, 28 Jun 2019 22:38:56 +0000 (22:38 +0000)]
constraint guide: Shorten names
Now that this is its own source file,
no need for these prefixes anymore.
Matthias Clasen [Fri, 28 Jun 2019 20:55:13 +0000 (20:55 +0000)]
constraint layout: Measure more correctly
Set up all constraints for minimum + natural
width + height when measuring, regardless
of the orientation we're measuring. Anything
else will lead to incorrect answers when
there are constraints that cut across
dimensions.
Matthias Clasen [Fri, 28 Jun 2019 19:51:37 +0000 (15:51 -0400)]
solver: Fix a copy/paste error
Matthias Clasen [Fri, 28 Jun 2019 16:59:39 +0000 (16:59 +0000)]
constraint solver: Fix repeat suggestions
We were not storing the previous value, causing
the first two suggestions to work, but not later
ones.
Fixes the test added in the previous commit.
Matthias Clasen [Fri, 28 Jun 2019 16:30:07 +0000 (16:30 +0000)]
Amend a constraint solver test
Make the 'repeat edit' test make more than to
suggestions in a single edit phase. It turns out
that this does not work, whereas just doing
two in a row does.
Matthias Clasen [Thu, 27 Jun 2019 22:06:53 +0000 (22:06 +0000)]
demo: Use constraint guide api
Use proper api to create and set up
the guide, and also try max-width.
Matthias Clasen [Thu, 27 Jun 2019 19:25:04 +0000 (19:25 +0000)]
Flesh out GtkConstraintGuide
This commit moves GtkConstraintGuide into its own
source files to avoid gtkconstraintlayout.c turning
too messy, adds max size properties and implements
getters and setters.
Matthias Clasen [Thu, 27 Jun 2019 19:32:56 +0000 (19:32 +0000)]
Drop an indirection
This struct is not really useful for just
a single hash table, and it gets in the way
of moving the guide code to its own file.
Matthias Clasen [Thu, 27 Jun 2019 18:49:54 +0000 (18:49 +0000)]
Detach guides on unroot
We don't want to leave constraints behind.
Matthias Clasen [Thu, 27 Jun 2019 18:40:15 +0000 (18:40 +0000)]
Simplify the guide implementation
Store the values and constraints in
arrays, to facilitate treating them
uniformly.
Emmanuele Bassi [Sun, 30 Jun 2019 09:36:33 +0000 (10:36 +0100)]
Return the list of constraints added via VFL description
Otherwise it's impossible to remove them.
Emmanuele Bassi [Sun, 30 Jun 2019 09:30:02 +0000 (10:30 +0100)]
Add method to remove all constraints from a layout
Georges Basile Stavracas Neto [Sun, 30 Jun 2019 22:51:51 +0000 (19:51 -0300)]
Adwaita: Also apply $color_menu to popover arrows
So that popovers and arrows are always in agreement of
the background color.
Georges Basile Stavracas Neto [Sun, 30 Jun 2019 22:47:32 +0000 (19:47 -0300)]
Adwaita: Use $menu_color background in popover.menu
GtkPopoverMenus should mimic menus. Commit
d936967b7a8 introduced
some CSS related to menu popovers, however, it hardcodes 'white'
as the background color. That is problematic for the dark theme.
Use '$menu_color' instead of 'white', since $menu_color both
guarantees menu popovers and menus match, and already handles
different colors for dark and light theme variants.
Emmanuele Bassi [Sat, 29 Jun 2019 18:04:29 +0000 (19:04 +0100)]
Add a C convenience function for VFL constraints
The dictionary-based function is convenient for language bindings, but C
developers will feel more at home with a variadic arguments list.
Emmanuele Bassi [Sat, 29 Jun 2019 17:50:55 +0000 (18:50 +0100)]
Add Constraints/VFL demo
Shows how to describe constraints using VFL instead of constructing
objects manually.
Emmanuele Bassi [Sat, 29 Jun 2019 17:32:56 +0000 (18:32 +0100)]
Allow adding constraints described through VFL
Emmanuele Bassi [Sat, 29 Jun 2019 17:03:42 +0000 (18:03 +0100)]
Add VFL parser for constraints
Constraints can be expressed with a compact syntax, called VFL (visual
format language).
Emmanuele Bassi [Sat, 29 Jun 2019 16:21:55 +0000 (17:21 +0100)]
Remove GtkConstraintVariable.set_prefix()
The prefix and name are set at construction time.
Matthias Clasen [Wed, 26 Jun 2019 03:35:10 +0000 (03:35 +0000)]
Add an interactive constraints demo
Matthias Clasen [Wed, 26 Jun 2019 02:35:15 +0000 (02:35 +0000)]
Make the constraints demo more interesting
Add a max size to the buttons, to force the
space to open up.
Matthias Clasen [Tue, 25 Jun 2019 23:38:32 +0000 (19:38 -0400)]
Add GtkConstraintGuide
This is meant to be a flexible space.
Emmanuele Bassi [Thu, 27 Jun 2019 17:26:19 +0000 (18:26 +0100)]
Use generic pointers for constraint targets
Since GtkWidget implements GtkConstraintTarget, we can omit the explicit
cast, and validate the type at run time.
Matthias Clasen [Tue, 25 Jun 2019 19:16:02 +0000 (15:16 -0400)]
Redefine constraints with GtkConstraintTarget
This is in preparation for allowing non-widgets
to act as constraint targets.
Matthias Clasen [Tue, 25 Jun 2019 19:05:29 +0000 (19:05 +0000)]
widget: Implement GtkConstraintTarget
Matthias Clasen [Tue, 25 Jun 2019 19:04:05 +0000 (15:04 -0400)]
Add GtkConstraintTarget
This is an marker interface that we will
use to accept other things that widgets
in constraints.
Emmanuele Bassi [Thu, 27 Jun 2019 16:37:09 +0000 (17:37 +0100)]
Notify a layout change when adding and removing constraints
Changing the set of constraints should cause a relayout.
Emmanuele Bassi [Thu, 27 Jun 2019 16:34:29 +0000 (17:34 +0100)]
Fix the opposite size measurement in GtkConstraintLayout
We cannot use the given "for size" when querying our children, because
the constraint layout has no idea about the opposite size of its
children until the layout is complete.
Additionally, we should only suggest an opposite size for the layout if
we have one, instead of suggesting a weak zero size.
Emmanuele Bassi [Thu, 27 Jun 2019 16:08:48 +0000 (17:08 +0100)]
Remove size constraints from ConstraintLayoutChild
The size constraints are transient to measurement and allocation, so
they don't really need to be stored inside the GtkLayoutChild subclass
created by a GtkConstraintLayout.
Matthias Clasen [Wed, 26 Jun 2019 02:30:31 +0000 (02:30 +0000)]
constraints: Make internal consistency required
The relations between left, right, width
and top, bottom, height are required for
internal consistency. It doesn't make sense
to ever drop these.
Changing the strength of these relations makes
my systems behave much more stable.
Matthias Clasen [Wed, 26 Jun 2019 03:40:03 +0000 (03:40 +0000)]
Add gtk_constraint_layout_remove_constraint
Otherwise, you can't do many interesting things.
Emmanuele Bassi [Thu, 27 Jun 2019 15:42:58 +0000 (16:42 +0100)]
Do not release reference on the subject of an expression
We don't own the reference in the first place.
Matthias Clasen [Thu, 27 Jun 2019 01:43:47 +0000 (01:43 +0000)]
constraints solver: Avoid critials
When the solver is finalized with existing
constraints, we end up with criticals when
the constraints ref finalize code calls
back into the hash table. Avoid that by
emptying the hash table beforehand.
Matthias Clasen [Wed, 26 Jun 2019 20:08:08 +0000 (20:08 +0000)]
constraint solver: Fix thawing
There was an obviously wrong precondition here.
Emmanuele Bassi [Mon, 17 Jun 2019 08:26:39 +0000 (09:26 +0100)]
Do not leak LayoutChild instances
Since the LayoutManager owns the LayoutChild it creates, it's also
responsible for mopping them up.
Emmanuele Bassi [Thu, 13 Jun 2019 18:33:36 +0000 (19:33 +0100)]
Add GtkConstraintLayout demo
Emmanuele Bassi [Tue, 9 Apr 2019 14:33:52 +0000 (15:33 +0100)]
Add GtkConstraintLayout
A layout manager using GtkConstraintSolver to measure and allocate
children.
Emmanuele Bassi [Mon, 10 Jun 2019 13:43:14 +0000 (14:43 +0100)]
Propagate rooting and unrooting widgets to layout managers
Layout managers may need to get access to data attached to the root of a
scene graph.
Emmanuele Bassi [Tue, 9 Apr 2019 13:22:19 +0000 (14:22 +0100)]
window: Create a GtkConstraintSolver
Implement the GtkRoot getter for GtkConstraintSolver.
Emmanuele Bassi [Tue, 9 Apr 2019 13:20:54 +0000 (14:20 +0100)]
Assign a GtkConstraintSolver to each GtkRoot
Constraints need to work across different parents, so it's better to
have a single constraint solver per top level.
Emmanuele Bassi [Tue, 9 Apr 2019 13:13:37 +0000 (14:13 +0100)]
Move the Root interface to a private header
We don't expect out of tree implementations of GtkRoot, and having the
interface structure private to the GTK code allows us to add virtual
functions involving private types.
Emmanuele Bassi [Tue, 9 Apr 2019 13:05:48 +0000 (14:05 +0100)]
Add constraint solver
GtkConstraintSolver is an implementation of the Cassowary constraint
solving algorithm:
http://constraints.cs.washington.edu/cassowary/
The Cassowary method allows to incrementally solve a tableau of linear
equations, in the form of:
x = y × coefficient + constant
with different weights, or strengths, applied to each one.
These equations can be used to describe constraints applied to a layout
of UI elements, which allows layout managers using the Cassowary method
to quickly, and efficiently, lay out widgets in complex relations
between themselves and their parent container.
Matthias Clasen [Sun, 30 Jun 2019 18:35:28 +0000 (18:35 +0000)]
Fix a crash in action muxer destruction
I've seen a crash when the action muxer gets
disposed during widget destroy, and tries to
disconnect from widget signals too late.
There is no real need to disconnect, since the
only time an action muxer is going away is when
its widget is destroyed, so just don't do it.
Timm Bäder [Sat, 29 Jun 2019 07:39:20 +0000 (09:39 +0200)]
transform: Add transform_bounds fast path for 2D_AFFINE transforms
E.g. anything involving a scale. This is important when e.g. scrolling
in the node list in the recorder, which scales every recorded node down
to fit in the list.
Timm Bäder [Sat, 29 Jun 2019 07:06:32 +0000 (09:06 +0200)]
Adwaita: Fix popover style
We add the .background class to the popover node now.
Timm Bäder [Sat, 29 Jun 2019 06:57:27 +0000 (08:57 +0200)]
gl renderer: Fix push/pop modelview behavior
Timm Bäder [Sat, 29 Jun 2019 06:53:36 +0000 (08:53 +0200)]
gl renderer: Remove some dead code
Timm Bäder [Sat, 29 Jun 2019 05:13:10 +0000 (07:13 +0200)]
gl renderer: Don't upload GL textures into the icon cache
Timm Bäder [Sat, 29 Jun 2019 05:12:10 +0000 (07:12 +0200)]
transform: Add skew parsing
Matthias Clasen [Fri, 28 Jun 2019 19:21:21 +0000 (19:21 +0000)]
Add another grid layout test
This one will be used for comparison
with constraint layouts.